# Maintainer: Sergej Pupykin <pupykin.s+arch@gmail.com>
# Maintainer: Thorsten Töpper <atsutane-tu@freethoughts.de>
# Contributor:  3ED <kas1987@o2.pl>

pkgname=mcabber
pkgver=1.1.2
pkgrel=2
pkgdesc="A small Jabber console client, includes features: SSL, PGP, MUC, UTF8"
arch=('loong64' 'x86_64')
url="https://www.lilotux.net/~mikael/mcabber/"
license=('GPL')
depends=('ncurses' 'glib2' 'loudmouth' 'gpgme' 'libotr' 'aspell')
makedepends=('pkg-config')
validpgpkeys=('EACADFF156849BC89653139E3C2900DEACB7FC95')
source=(https://www.lilotux.net/~mikael/mcabber/files/$pkgname-${pkgver/_/-}.tar.bz2{,.asc}
        format-security.patch)
sha256sums=('c4a1413be37434b6ba7d577d94afb362ce89e2dc5c6384b4fa55c3e7992a3160'
            'SKIP'
            'f075365bda322b9808f0ddf60390b243b54c7148cf01d261341f293cf7c46279')

prepare() {
  cd $pkgname-${pkgver/_/-}
  patch -p2 -i ../format-security.patch # Fix format-security warnings
}

build() {
  cd "${srcdir}"/$pkgname-${pkgver/_/-}
  CFLAGS+=' -fcommon' # https://wiki.gentoo.org/wiki/Gcc_10_porting_notes/fno_common
  ./configure --prefix=/usr --enable-hgcset \
      --mandir=/usr/share/man \
      --enable-aspell --enable-otr
  make
}

package() {
  cd "${srcdir}"/$pkgname-${pkgver/_/-}

  make DESTDIR="${pkgdir}" install
  mkdir -p "${pkgdir}"/usr/share/mcabber/example
  cp -a "${srcdir}"/$pkgname-${pkgver/_/-}/mcabberrc.example \
	"${pkgdir}"/usr/share/mcabber/example/mcabberrc
}
